import sympy
# def is_prime(n):  #验证n是否为素数
#     if n <= 1:
#         return False
#     if n <= 3:
#         return True
#     if n % 2 == 0 or n % 3 == 0:
#         return False
#     i = 5
#     while i * i <= n:
#         if n % i == 0 or n % (i + 2) == 0:
#             return False
#         i += 6
#     return True

def print_primes(limit):
    count = 0
    for num in range(1, limit + 1):
        if sympy.isprime(num):
            print(f"{num:5d}", end=" ")
            count += 1
            if count % 5 == 0:
                print()

print_primes(20000)
